package com.onepiece.shipelves.common.exception;

import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.enums.BaseExceptionEnum;


public class QuHuiRuntimeException extends java.lang.RuntimeException implements BaseException {

    private String code;

    private String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public QuHuiRuntimeException(BaseExceptionEnum baseExceptionEnum) {
        this.code = baseExceptionEnum.getExceptionCode();
        this.message = baseExceptionEnum.getExceptionMessage();
    }

    public QuHuiRuntimeException(String code, String message) {
        this.code = code;
        this.message = message;
    }
    @Override
    public Result createResult() {
        Result result = new Result();
        result.setCode(this.code);
        result.setMessage(this.message);
        return result;
    }
}
